<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
// 初始化一个数组    
const arr=[2,6,1,7,4]
// 初始化一个和的变量
let sum=0
for (let i = 0; i < arr.length; i++) {
    sum+=arr[i]
}
// 平均值
let meanNumber=sum/arr.length
console.log(sum)
console.log(meanNumber)
</script>
</body>
</html>